{{#models}}{{#model}}
{{#emitJSDoc}}
  /**
   * The {{classname}} model module.
   * @module {{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{classname}}
   * @version {{projectVersion}}
   */

  /**
   * Constructs a new <code>{{classname}}</code>.{{#description}}
   * {{.}}{{/description}}
   * @alias module:{{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{classname}}
   * @class{{#useInheritance}}{{#parent}}
   * @extends {{#parentModel}}module:{{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-is-array}}Array{{/vendorExtensions.x-is-array}}{{#vendorExtensions.x-is-map}}Object{{/vendorExtensions.x-is-map}}{{/parentModel}}{{/parent}}{{#interfaces}}
   * @implements module:{{#invokerPackage}}{{.}}/{{/invokerPackage}}{{#modelPackage}}{{.}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
   * @param {{name}} {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{{description}}}{{/vendorExtensions.x-all-required}}
   */
{{/emitJSDoc}}
  var exports = function({{#vendorExtensions.x-all-required}}{{name}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
    var _this = this;
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-is-array}}    _this = new Array();
    Object.setPrototypeOf(_this, exports);
{{/vendorExtensions.x-is-array}}{{/parentModel}}{{/parent}}
    {{#useInheritance}}
    {{#parentModel}}
    {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
    {{/parentModel}}
    {{^parentModel}}
    {{#interfaceModels}}
    {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{name}}{{/vendorExtensions.x-all-required}});
    {{/interfaceModels}}
    {{/parentModel}}
    {{/useInheritance}}
    {{#vars}}
    {{#required}}
    {{#defaultValue}}
    _this['{{baseName}}'] = {{name}} || {{{defaultValue}}};
    {{/defaultValue}}
    {{^defaultValue}}
    _this['{{baseName}}'] = {{name}};
    {{/defaultValue}}
    {{/required}}
    {{/vars}}
    {{#parent}}
    {{^parentModel}}
    return _this;
    {{/parentModel}}
    {{/parent}}
  };

{{#emitJSDoc}}
  /**
   * Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
   * @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
   */
{{/emitJSDoc}}
{{#vendorExtensions.x-is-primitive}}
  exports.constructFromObject = function(data, obj) {
    return data;
  }
{{/vendorExtensions.x-is-primitive}}
{{^vendorExtensions.x-is-primitive}}
  exports.constructFromObject = function(data, obj) {
    if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
      obj = obj || new exports();
      {{#parent}}
      {{^parentModel}}
      ApiClient.constructFromObject(data, obj, '{{vendorExtensions.x-item-type}}');
      {{/parentModel}}
      {{/parent}}
      {{#useInheritance}}
      {{#parentModel}}
      {{classname}}.constructFromObject(data, obj);
      {{/parentModel}}
      {{^parentModel}}
      {{#interfaces}}
      {{.}}.constructFromObject(data, obj);
      {{/interfaces}}
      {{/parentModel}}
      {{/useInheritance}}
      {{#vars}}
      if (data.hasOwnProperty('{{baseName}}')) {
        obj['{{baseName}}']{{{defaultValueWithParam}}}
      }
      {{/vars}}
    }
    return obj;
  }
{{/vendorExtensions.x-is-primitive}}
{{#useInheritance}}{{#parentModel}}
  exports.prototype = Object.create({{classname}}.prototype);
  exports.prototype.constructor = exports;
{{/parentModel}}{{/useInheritance}}
{{#vars}}
{{#emitJSDoc}}
  /**{{#description}}
   * {{{.}}}{{/description}}
   * @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
   * @default {{{.}}}{{/defaultValue}}
   */
{{/emitJSDoc}}
  exports.prototype['{{baseName}}'] = {{{defaultValue}}}{{^defaultValue}}undefined{{/defaultValue}};
{{/vars}}{{#useInheritance}}{{#interfaceModels}}
  // Implement {{classname}} interface:{{#allVars}}
{{#emitJSDoc}}
  /**{{#description}}
   * {{{.}}}{{/description}}
   * @member {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{baseName}}{{#defaultValue}}
   * @default {{{.}}}{{/defaultValue}}
   */
{{/emitJSDoc}}
exports.prototype['{{baseName}}'] = {{{defaultValue}}}{{^defaultValue}}undefined{{/defaultValue}};
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
{{#emitModelMethods}}{{#vars}}
{{#emitJSDoc}}
  /**{{#description}}
   * Returns {{{.}}}{{/description}}{{#minimum}}
   * minimum: {{.}}{{/minimum}}{{#maximum}}
   * maximum: {{.}}{{/maximum}}
   * @return {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=>
   */
{{/emitJSDoc}}
  exports.prototype.{{getter}} = function() {
    return this['{{baseName}}'];
  }

{{#emitJSDoc}}
  /**{{#description}}
   * Sets {{{.}}}{{/description}}
   * @param {{=< >=}}{<&vendorExtensions.x-jsdoc-type>}<={{ }}=> {{name}}{{#description}} {{{.}}}{{/description}}
   */
{{/emitJSDoc}}
  exports.prototype.{{setter}} = function({{name}}) {
    this['{{baseName}}'] = {{name}};
  }

{{/vars}}{{/emitModelMethods}}
{{#vars}}
{{#isEnum}}
{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}
{{/isEnum}}
{{#items.isEnum}}
{{#items}}
{{^isContainer}}
{{>partial_model_inner_enum}}
{{/isContainer}}
{{/items}}
{{/items.isEnum}}
{{/vars}}

  return exports;
{{/model}}{{/models}}}));
